/*
 * This class is part of the filesharing and VoD library for ProtoPeer. It was
 * developed in the EU ICT Project SmoothIT (FP7-2007-ICT-216259,
 * http://www.smoothit.org) and is provided as it is and without warranty.
 * It is licensed under the CC-GNU GPL:
 * http://creativecommons.org/licenses/GPL/2.0/
 */
package it.polimi.protopeer.simulation;

import protopeer.PeerIdentifier;

/**
 * Used to identify peers in the interdomain network.
 */
public class AddressPeerIdentifier extends PeerIdentifier {

	private static final long serialVersionUID = -951164642429480560L;
	
	private long addressLongValue;
	
	public AddressPeerIdentifier(long addressLongValue) {
		this.addressLongValue = addressLongValue;
	}
	
	@Override
	public double distanceTo(PeerIdentifier otherIdentifier) {
		return 0;
	}

	@Override
	public double getMaxDistance() {
		return 0;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (int) (addressLongValue ^ (addressLongValue >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof AddressPeerIdentifier)) {
			return false;
		}
		AddressPeerIdentifier other = (AddressPeerIdentifier) obj;
		if (addressLongValue != other.addressLongValue) {
			return false;
		}
		return true;
	}
}
